package eu.telecom_bretagne.RECRUT.data.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.Set;


/**
 * The persistent class for the offre database table.
 * 
 */
@Entity
@NamedQuery(name="Offre.findAll", query="SELECT o FROM Offre o")
public class Offre implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="OFFRE_ID_GENERATOR", sequenceName="OFFRE_ID_SEQ", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="OFFRE_ID_GENERATOR")
	private Integer id;

	@Temporal(TemporalType.DATE)
	@Column(name="date_depot")
	private Date dateDepot;

	@Column(name="descriptif_mission")
	private String descriptifMission;

	@Column(name="profil_recherche")
	private String profilRecherche;

	private String titre;

	//bi-directional many-to-one association to DossierCandidature
	@OneToMany(mappedBy="offre")
	private Set<DossierCandidature> dossierCandidatures;

	//bi-directional many-to-one association to Employe
	@ManyToOne
	@JoinColumn(name="id_employe")
	private Employe employe;

	public Offre() {
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Date getDateDepot() {
		return this.dateDepot;
	}

	public void setDateDepot(Date dateDepot) {
		this.dateDepot = dateDepot;
	}

	public String getDescriptifMission() {
		return this.descriptifMission;
	}

	public void setDescriptifMission(String descriptifMission) {
		this.descriptifMission = descriptifMission;
	}

	public String getProfilRecherche() {
		return this.profilRecherche;
	}

	public void setProfilRecherche(String profilRecherche) {
		this.profilRecherche = profilRecherche;
	}

	public String getTitre() {
		return this.titre;
	}

	public void setTitre(String titre) {
		this.titre = titre;
	}

	public Set<DossierCandidature> getDossierCandidatures() {
		return this.dossierCandidatures;
	}

	public void setDossierCandidatures(Set<DossierCandidature> dossierCandidatures) {
		this.dossierCandidatures = dossierCandidatures;
	}

	public DossierCandidature addDossierCandidature(DossierCandidature dossierCandidature) {
		getDossierCandidatures().add(dossierCandidature);
		dossierCandidature.setOffre(this);

		return dossierCandidature;
	}

	public DossierCandidature removeDossierCandidature(DossierCandidature dossierCandidature) {
		getDossierCandidatures().remove(dossierCandidature);
		dossierCandidature.setOffre(null);

		return dossierCandidature;
	}

	public Employe getEmploye() {
		return this.employe;
	}

	public void setEmploye(Employe employe) {
		this.employe = employe;
	}

}